<script setup>
import { computed, unref } from 'vue'
import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign'

// props
const props = defineProps({
  color: {
    type: String,
    default: ''
  }
})

// 前缀类名
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('collapse')

// store
const appStore = useAppStore()
const collapse = true;// computed(() => appStore.getCollapse)

const toggleCollapse = () => {
  const collapsed = unref(collapse)
  appStore.setCollapse(!collapsed)
}
</script>

<template>
  <div :class="prefixCls" @click="toggleCollapse">
    <Icon
      :size="18"
      :icon="collapse ? 'vi-ant-design:menu-unfold-outlined' : 'vi-ant-design:menu-fold-outlined'"
      :color="props.color"
      class="cursor-pointer"
    />
  </div>
</template>
